<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont iconfanhui back-icon"></div>
    </div>
    <div class="header-input">
      <span class="iconfont iconsousuo"></span>
      输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
      <div class="header-right">
        <!--公用数据获取-->
        {{this.city}}
        <span class="iconfont iconjiantouarrow486 arr-icon"></span>
      </div>
    </router-link>
  </div>
</template>

<script>
  //计算属性引用vuex 或者 直接调用{{this.$store.state.city}}
  import {mapState} from 'vuex'

  export default {
    name: 'HomeHeader',
    // props: {
    //   city: String
    // },
    computed: {
      ...mapState(['city'])
    }
  }
</script>
<!--scoped只对当前有效-->
<!--1 rem = html font-size = 50 px 86/100-->
<style lang="stylus" scoped>
  @import "~@/assets/styles/varibles.styl"
  .header
    background: $bgColor
    color: #ffffff
    display: flex
    height: .86rem
    line-height .86rem

    .header-left
      width .64rem
      float: left

      .back-icon
        text-align center
        font-size .4rem

    .header-input
      flex: 1
      background #ffffff
      line-height .64rem
      color #ccc
      padding-left .2rem
      border-radius .1rem
      margin-top .12rem
      margin-bottom .12rem
      height .64rem

    .header-right
      min-width 1.04rem
      padding 0 .1rem
      float: right
      margin-left .3rem
      color blue

      .arr-icon
        font-size .04rem
        margin-left .14rem

</style>
